<?php 
  //$cnx = new PDO("odbc:Driver={SQL Server};Server=192.168.0.51;Database=YZRMYY_PRMS;",'sa','kazarus0618'); 
  $cnx = new PDO("mysql:host=localhost;dbname=db_demo","root","kazarus0618");
  //var_dump($cnx);
   
  //$cnx->query("set charset utf8");
  $cnx->query("set names utf8");
  $DataSet = $cnx->query("SELECT * FROM TBL_USER"); 
  //var_dump($DataSet); 
  
  
  
  //while ($result = $DataSet->fetch(PDO::FETCH_OBJ))
  
  
  /* it works
  while ($result = $DataSet->fetch(PDO::FETCH_OBJ))
  {
  	//print_r($result);
  	//print $result->STAF_NAME."\n";
    
	  echo json_encode($result);
  }
  */
  $result = $DataSet->fetchAll();
  echo json_encode($result);
  
  
  
?> 